<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <title>四六级在线报名系统-报名页面</title>
  <script src="js/jquery-3.3.1.min.js"></script>
	<link rel="stylesheet" href="layui/css/layui.css" media="all"></link>
	<script src="layui/layui.js"></script>
	<script src="layer/layer.js"></script>
	<link rel="stylesheet" href="layer/mobile/need/layer.css" />
	<link rel="stylesheet"  href="layer/theme/default/layer.css"/>
</head>
<body class="layui-layout-body">

  <!--添加或编辑用户-->
		<div id="setUser" class="layer_self_wrap" style="width:500px;display:none;">
			<form id="userForm" class="layui-form layui-form-pane" method="post" action="" style="margin-top: 20px;">

				<input id="Id" type="hidden" name="id" />
				<div class="layui-form-item">
					<label class="layui-form-label">用户名</label>
					<div class="layui-input-inline">
						<input id="OrdinaryUserName" name="OrdinaryUserName" lay-verify="required" autocomplete="off" class="layui-input" type="text" />
					</div>
				</div>
			<div class="layui-form-item">
					<label class="layui-form-label">身份证</label>
					<div class="layui-input-inline">
						<input id="IdNumber" name="IdNumber" lay-verify="required" autocomplete="off" class="layui-input" type="text" />
					</div>
				</div>
				<div class="layui-form-item">
			<!-- 	<label class="layui-form-label">密码</label> -->
					<div class="layui-input-inline">
						<input id="OrdinaryUserPassword" name="OrdinaryUserPassword" lay-verify="required" autocomplete="off" class="layui-input" type="hidden" onkeyup="this.value=this.value.replace(/\D/g,'')" onafterpaste="this.value=this.value.replace(/\D/g,'')" />
					</div>
				</div>
				<div class="layui-form-item">
					<label class="layui-form-label">邮箱</label>
					<div class="layui-input-inline">
						<input id="OrdinaryUserEmail" name="OrdinaryUserEmail" lay-verify="required | email" autocomplete="off" class="layui-input" type="text" />
					</div>
				</div>
				
				<div class="layui-form-item">
			<!--	 	<label class="layui-form-label">头像</label> -->
					<div class="layui-input-inline" id="Img">
				   	<input id="OrdinaryUserImg" name="OrdinaryUserImg" lay-verify="required | email" autocomplete="off" class="layui-input" type="hidden" />
					 
					</div>
				</div>

				<div class="layui-form-item" >
			<!--		 <label class="layui-form-label">状态</label> -->
					<div class="layui-input-inline">
						<input id="OrdinaryUserStatus" name="OrdinaryUserStatus" lay-verify="required | school" autocomplete="off" class="layui-input" type="hidden" />
					</div>
				</div>
				 
 
				<div class="layui-form-item">
					<div class="layui-input-block" style="margin-left: 10px;">
						<button class="layui-btn" lay-submit=""   lay-filter="userSubmit">提交</button>
						<button type="reset" class="layui-btn layui-btn-primary">重置</button>
					</div>
				</div>
			</form>
		</div>
  
  <div align="center">
  <p><font size="25" color="#009F95">欢迎登录CET考试报名系统</font></p>
 <br>
    <p><font size="20" color="#28A6FF">基本信息</font></p>
   <div style="width: 25%;" align="left">
   	<br>
   <p><font size="6px" color="#2E2D3C">报名状态：</font> <span id="status"></span> </p>
      	<br>
  <p><font size="5px" color="#2E2D3C">允许报名时间：<br>2018.3.24--2018.4.30</font></p>
     	<br>
  </div>
  <div id="add">
  	
  <a  onclick="confirm()" class="layui-btn">开始报名</a>
  </div>
  </div>
  <div id="card" style="display: none;">
  <table class="layui-table" id="exameeinfo" lay-filter="exameeinfo" style="display: none;"  align="center"></table>
			<script type="text/html" id="barexameeinfo">
			<a class="layui-btn layui-btn-xs" lay-event="print" id="print">打印准考证</a>
		</script>
		</div>
</div>

		<div align="left" id="idcard" style="display: none;">
			
			<table cellspacing=0 border=1 style="bordercolor:#C0C0C0;" align="center" width="80%">
　　<tr align="center" style="background:#628FC3"><td colspan="5" height="60px" width="100%" >英语四六级考生准考证</td></tr>
　　<tr align="center"><td height="100px" style="background:#92D050">考试介绍</td>
	<td colspan="4" style="background:#00B0F0">考生头像:<img id="uimg" width="100px" height="100px"></img></td></tr>　
　<tr align="center" style="background:#CBDAEB"><td height="50px" width="10%">准考证号:<span id="qnumber"></span></td>
	<td width="10%">身份证号：<span id="idnumber"></span></td>
	<td width="10%">考生姓名:<span id="uname"></span></td></tr>
　<tr align="center" style="background:#CBDAEB"><td height="50px" width="10%">考试名称:<span id="tname"></span></td>
	<td width="10%">考试时间：<span id="ttime"></span></td>
	<td width="10%">考试地点:<span id="tsite"></span></td></tr>
　　<tr align="center"><td height="50px" colspan="5" style="background:#FFC000">备注：xxxxxx</td></tr>
</table>
	 
		</div>
 
<script type="text/javascript" src="js/config.js" ></script>
<script>
	function logout()
	{
		
		 localStorage.removeItem('cuser');
		 window.location.href="login.html";
	}
	layui.use('table', function() {
		var table = layui.table,
			form = layui.form;
		 

		form.on('submit(userSubmit)', function(data) {
			formSubmit(data);
			return false;
		});
	});
	data=localStorage.getItem("cuser");
	//data=JSON.stringify(data);
	data=JSON.parse(data);
	//;
	if(data!=null)
	{
 
		$.get(rooturl+"examineeinfobyidnum", {
			"idnum": data.idNumber
		}, function(datas) {
			if(datas.data.pop()!=null) {
				 document.getElementById("status").innerHTML="已经报名";
				 document.getElementById("status").style.fontSize='30px';  
           document.getElementById("status").style.color='#009F95'; 
				 
				document.getElementById("card").style.display='';
				document.getElementById("add").style.display='none';
				print(data.idNumber);
			}
			else
			{
					 document.getElementById("status").innerHTML="未报名";
					 document.getElementById("status").style.fontSize='30px';  
           document.getElementById("status").style.color='red'; 
			}
		});
		
	}
	else{
		window.location.href="login.html";
	}
 
	
//JavaScript代码区域
layui.use('element', function(){
  var element = layui.element;
  
});
function confirm()
{
layer.confirm('同意报名协议？', {
  btn: ['同意','不同意'] //按钮
}, function(){
	 window.location.href="addinfo.html";  
  layer.msg('同意', {icon: 1});
}, function(){
  layer.msg('不同意', {
    time: 20000, //20s后自动关闭
     
  });
});
}


 
	
	function print(idnumber)
	{
		
	layui.use('table', function() {
		
			data=localStorage.getItem("cuser");
	//data=JSON.stringify(data);
	data=JSON.parse(data);
		idnumbers=data.idNumber;
		var table = layui.table,
			form = layui.form;
			//监听单元格编辑
			tableIns=table.render({
				elem: '#exameeinfo',
				url: rooturl+'examineeinfobyidnum?idnum='+idnumbers //数据接口
				,
				id: 'idTest',
				cellMinWidth: 80
					,
				cols: [
					[ 
						{
							field: 'uName',
							title: '姓名',
					 
							sort: true,
							fixed: true
						},
						{
							field: 'uIdnumber',
							title: '身份证' 
					 
						},
						{
							field: 'qNumber',
							title: '准考证'  
						},
						{
							field: 'tName',
							title: '考试名称' 
						},
						{
							field: 'tSite',
							title: '考试地点' 
						},
						{
							field: 'tTime',
							title: '时间' 
						},{
							field: 'right',
							 
							align: 'center',
							toolbar: '#barexameeinfo'
						}
					]
				],
				done: function(res, curr, count){
    				
     pageCurr=curr;
 }
			});
			table.on('tool(exameeinfo)', function(obj) {
		if(obj.event === 'print') { //编辑修改
			var data = obj.data;
			 //document.getElementById("idcard").style.display='';
			 document.getElementById("qnumber").innerText = data.qNumber;
			 document.getElementById("idnumber").innerText = data.uIdnumber;
			 document.getElementById("uname").innerText = data.uName;
			 document.getElementById("ttime").innerText = data.tTime;
			 document.getElementById("tname").innerText = data.tName;
			 document.getElementById("tsite").innerText = data.tSite;
			 document.getElementById("uimg").src = rooturl+data.uImg;
			
			layer.open({
			type: 1,
			title: "准考证",
			fixed: false,
			resize: false,
			shadeClose: true,
			area: ['60%'],
			content: $('#idcard')
		});
			}
		});
		
		$('.demoTable .layui-btn').on('click', function() {
			var type = $(this).data('type');
			active[type] ? active[type].call(this) : '';
		});
		 
	});
 }


 
	
</script>
</body>
</html>